package com.wxw.BaseLibrary.drawable;

import android.view.ViewGroup;
import android.widget.LinearLayout;

/**
 * Created by david on 2015-10-15.
 */
public class LayoutParamTool {
    public static LinearLayout.LayoutParams createParams(int left, int top, int right, int bottom){
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParams.setMargins(left, top, right, bottom);
        return layoutParams;
    }

    public static LinearLayout.LayoutParams createParams(int margin) {
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParams.setMargins(margin, margin, margin, margin);
        return layoutParams;
    }

    public static LinearLayout.LayoutParams createMatchParams(int margin) {
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        layoutParams.setMargins(margin, margin, margin, margin);
        return layoutParams;
    }

    public static LinearLayout.LayoutParams createMatchParams(int margin, int weight) {
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, weight);
        layoutParams.setMargins(margin, margin, margin, margin);
        return layoutParams;
    }

    public static LinearLayout.LayoutParams createMatchParams(int left, int top, int right, int bottom, int weight) {
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, weight);
        layoutParams.setMargins(left, top, right, bottom);
        return layoutParams;
    }

    public static LinearLayout.LayoutParams createParams(int margin, int width, int height) {
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(width, height);
        layoutParams.setMargins(margin, margin, margin, margin);
        return layoutParams;
    }
}
